package cn.edu.cimv.service.impl;

import cn.edu.cimv.dao.entity.News;
import cn.edu.cimv.dao.mapper.NewsMapper;
import cn.edu.cimv.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 门铎 on 2016/6/27.
 */
@Service
public class NewsServiceImpl implements NewsService {
    @Autowired private NewsMapper newsMapper;
    @Override
    public void editNews(News news) {
        newsMapper.insertNews(news);
    }

    @Override
    public List<News> queryNews(int flag) {
        return newsMapper.queryNews(flag);
    }

    @Override
    public void deleteNews(int id) {
        newsMapper.deleteNews(id);
    }

    @Override
    public News queryNewsById(int id) {
        return newsMapper.queryNewsById(id);
    }

    @Override
    public void updateNews(News news) {
         newsMapper.updateNews(news);
    }

    @Override
    public void setLastNews(int id,int flag) {
        newsMapper.updateFlagById(id,flag);
    }
}
